import mysql from "../../db/index.js"

export async function getAllStudent(req, res) {
    console.log(req.query.pageIndex);
    try {
        const [data] = await mysql.query('select * from sys_student limit ' + (req.query.pageIndex - 1) * 10 + ',' + req.query.pageIndex * 10)
        const [total] = await mysql.query('select * from sys_student')
        console.log(data);
        res.send({
            status: 0,
            msg: '数据请求成功',
            data: data,
            total: total.length
        })
    } catch (e) {
        res.send({
            status: 1,
            msg: '数据请求失败',
            data: e
        })
    }
}  